﻿@model Guid
@section Styles{
    <style type="text/css">
        html, body {
            background: #ffffff;
        }
    </style>
}
@section Scripts{
    <script type="text/javascript">
        var app = new Vue({
            el: "#app",
            data: function () {
                return {
                    form: {
                        saveState: false,
                        vm: {
                            Id: '@Model',
                            Model: {},
                            User_Name: null
                        }
                    }
                }
            },
            created: function () {
                this.loadForm();
            },
            mounted: function () {

            },
            methods: {
                loadForm: function () {
                    var path = `@Url.Action("LoadForm")/${this.form.vm.Id}`;
                    var _this = this;

                    hzyAdmin.post(path, {}, function (r) {
                        if (r.status != 1) return;
                        _this.form.vm = r.data;
                    });
                },
                closeWindow: function (delay = 0) {
                    setTimeout(function () {
                        hzyAdmin.layer.close(hzyAdmin.layer.getFrameIndex(window.name));
                    }, delay);
                },
                save: function () {
                    var path = `@Url.Action("Save")`;
                    var _this = this;

                    //验证
                    if (!this.form.vm.Model.AppLog_Name) return hzyAdmin.alert('功能名称不能为空!','警告');

                    this.form.saveState = true;
                    hzyAdmin.post(path, this.form.vm.Model, function (r) {
                        _this.form.saveState = false;
                        if (r.status == 1) {
                            hzyAdmin.alert('保存成功', '成功');
                            //关闭当前窗口
                            _this.closeWindow();
                        }
                    });
                }
            }
        });
    </script>
}
<div class="container-fluid hzyAdminForm" id="app">
    <div class="row">
        <div class="col-sm-12">
            <h4 class="example-title">Api</h4>
            <textarea class="form-control" v-model="form.vm.Model.AppLog_Api" autocomplete="off" readonly="readonly"></textarea>
        </div>
        <div class="col-sm-12">
            <h4 class="example-title">Ip</h4>
            <textarea class="form-control" v-model="form.vm.Model.AppLog_IP" autocomplete="off" readonly="readonly"></textarea>
        </div>
        <div class="col-sm-12">
            <h4 class="example-title">用户名称</h4>
            <textarea class="form-control" v-model="form.vm.Model.User_Name" autocomplete="off" readonly="readonly"></textarea>
        </div>
        <div class="col-sm-12">
            <h4 class="example-title">Form</h4>
            <textarea class="form-control" v-model="form.vm.Model.AppLog_Form" autocomplete="off" readonly="readonly"></textarea>
        </div>
        <div class="col-sm-12">
            <h4 class="example-title">FormBody</h4>
            <textarea class="form-control" v-model="form.vm.Model.AppLog_FormBody" autocomplete="off" readonly="readonly"></textarea>
        </div>
        <div class="col-sm-12">
            <h4 class="example-title">地址栏参数</h4>
            <textarea class="form-control" v-model="form.vm.Model.AppLog_QueryString" autocomplete="off" readonly="readonly"></textarea>
        </div>
    </div>
    <div class="hzyAdminForm-footer">
        <div class="row">
            <div class="col-sm-6"></div>
            <div class="col-sm-6 text-right">
                <button class="btn btn-danger" @@click="closeWindow()">关闭</button>
            </div>
        </div>
    </div>
</div>